package subject_set.offer100;

/**
 * @author haomin
 * @date 2022/10/27 16:38
 **/
public class Offer66 {
    class Solution {
        public int[] constructArr(int[] a) {
            if(a.length == 0) return new int[0];
            int[] res = new int[a.length];
            res[0] = 1;
            for(int i = 1; i < a.length; ++i){
                res[i] = res[i-1] * a[i-1];
            }
            int n = 1;
            for(int i = a.length-2; i >= 0; --i){
                n *= a[i+1];
                res[i] *= n;
            }
            return res;
        }
    }
}